package com.xxd.rpt3.vo;

import org.springframework.http.HttpStatus;

import java.io.Serializable;

public class ResultModel implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String SUCCESS = HttpStatus.OK.name();
	public static final Integer SUCCESS_CODE = HttpStatus.OK.value();

	private Integer code = SUCCESS_CODE;
	private String message;
	private Object data;

	public ResultModel() {
		this.code = SUCCESS_CODE;
		this.message = SUCCESS;
	}

	public ResultModel(int code, String message, Object data) {
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public ResultModel(HttpStatus data, String msg) {
		this.code = data.value();
		this.message = data.name() + ":" + msg;
	}

	public ResultModel(Object data) {
		this.code = SUCCESS_CODE;
		this.message = SUCCESS;
		this.data = data;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

}
